package com.jt;

import com.jt.provider.controller.TimeAccessInterceptor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 项目启动类
 * */
@SpringBootApplication
public class ProviderApplication {
    public static void main(String[] args) {
        SpringApplication.run(ProviderApplication.class, args);
    }
    @Configuration
    public class SpringWebConfig implements WebMvcConfigurer {//web.xml

        //配置spring mvc 拦截器
        @Override
        public void addInterceptors(InterceptorRegistry registry) {
            registry.addInterceptor(new TimeAccessInterceptor())
                    .addPathPatterns("/provider/sentinel01");
        }
    }
}
